/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.gwt.form.client.form;

/**
 * this interface define a simple button.
 */
public interface ButtonItem
    extends SimpleItem
{

  /**
   * the action of a button that does noting.
   */
  public static final String NONE_ACTION = "NONE";

  /**
   * the action of a button that goes to the previous page.
   */
  public static final String BACK_ACTION = "BACK";

  /**
   * the action of a button that goes to a given URL.
   */
  public static final String URL_ACTION = "URL";

  /**
   * the action of a button that reset the content of the form.
   */
  public static final String RESET_ACTION = "RESET";



  /**
   * get the type of action of the button. The possibility are : NONE, BACK or
   * URL. if the action is NONE, the user won't change page when using this
   * button, is it is BACK, it will be redirected to the previous page, if it is
   * URL it will be redirected to the URL given in the url property and if it is
   * RESET, the values of the form will be reseted.
   * 
   * @return the action of the button
   */
  public abstract String getAction();



  /**
   * returns the URL to redirect the user to if the action is URL.
   * 
   * @return the URL to redirect the user to
   */
  public abstract String getUrl();



  /**
   * returns whether to save the form before acting on the button. If this
   * property is <code>true</code> and the save failed, the button will not be
   * executed.
   * 
   * @return whether to save the form before acting on the button
   */
  public abstract boolean isSave();
}
